package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Weibo;
import cn.tedu._04mybatis.pojo.vo.*;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WeiboMapper {
    //插入表记录到微博表
    //@Insert("insert into weibo(content,created,user_id) values(#{content},#{created},#{userId})")
    int insertWeibo(Weibo weibo);

    //删除表记录从微博表
   // @Delete("delete from weibo where id=#{wid}")
    int deleteWeibo(Long wid);

    //更新表记录
    //@Update("update weibo set content=#{content}, created=#{created}, user_id=#{userId} where id=#{id}")
    int updateWeiboById(Weibo weibo);

    //查询单条数据
    //@Select("select id, content,created,user_id userId from weibo where id=#{wid}")
    Weibo selectWeiboById(Long wid);

    //查询多条数据
    //@Select("select id, content,created,user_id userId from weibo where user_id=#{uid}")
    List<Weibo> selectWeibosById(Long uid);

    //查询指定字段的单条数据
    //@Select("select content,created from weibo where id=#{wid}")
    WeiboVo1 selectWeibomes(Long wid);

    //查询指定字段的多条数据
    //@Select("select content,user_id userId from weibo ")
    List<WeiboVo2> selectWeibomesS();


    //动态修改语句
    int dynamicupdateById(Weibo weibo);

    //动态删除  数组
    int dynamicdeleteByIds1(Long[] longs);

    //动态删除  集合
    int dynamicdeleteByIds2(List<Long> list);

    //计数
    int countWeibo();

    //resultMap 单表查询
    ResultMapVo1 selectMap1(Long wid);

    //resultMao 多表查询
    ResultMapVo2 selectMap2(Long uid);

    //查询指定微博的所有评论
    ResultMapVo3 selectMap3(Long wid);


    ResultMapVo4 selectMap4(Long wid);



}
